<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath() + "/";
%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <link rel="stylesheet" type="text/css" href="<%=path %>sys/css/bootstrap.min.css" /> 
        <link rel="stylesheet" type="text/css" href="<%=path%>sys/easyui/themes/default/easyui.css">
        <link rel="stylesheet" type="text/css" href="<%=path%>sys/easyui/themes/icon.css">
        <link rel="stylesheet" type="text/css" href="<%=path%>sys/easyui/demo/demo.css">
        <script type="text/javascript" src="<%=path%>sys/easyui/jquery.min.js"></script>
        <script type="text/javascript" src="<%=path%>sys/easyui/jquery.easyui.min.js"></script>
        <script src="<%=path%>sys/js/uploadPreview.js"></script>
    </head>
    <style type="text/css">
        html{
            height:100%
        }

        body{
            height:100%;
            background:url(<%=path%>sys/images/myToto.jpg) top center no-repeat; background-size:cover;
        }
        .news h3,.news_three h3{margin:0;width: 100%;height: 30px;line-height: 30px;font-weight: normal;font-size:14px;text-indent: 10px;background:#0e92df;}
        .input-prepend{font-size:14px;}
        .charts h3 a,.news h3 a{float: right;margin-right: 10px;color: #fff;text-decoration: none;font-size: 14px;}
        .news h3{
            border-bottom: #ccc 1px solid;
            padding-bottom: 1px;
            background:#0F7474 !important;
            font-size:14px;
            font-family:"Microsoft YAHEI";
            color:#fff;
        }
        
    </style>
    <body>
        <div class="content" style="height:100%;">
            <div class=""></div>
            
            <div class="news" id="c1_1" style="height: auto;border:1px solid #fee;float:left;width:99%;margin:10px auto 15px;">
                <div id="tb" style="padding:2px 5px;margin:10px 0;">
                    <div class="input-prepend">
                        <span class="add-on" style="color: #333">开始时间</span>
                        <input id="beginTime" class="easyui-datebox" style="width: 100px;height:30px" data-options="editable:false">
                    </div>
                    <div class="input-prepend">
                        <span class="add-on" style="color: #333">结束时间</span>
                        <input id="endTime" class="easyui-datebox" style="width: 100px;height:30px" data-options="editable:false">
                    </div>
                    <div class="input-prepend">
                        <span class="add-on" style="color: #333">图片名称</span>
                        <input id="orgNo" style="width:150px;height:30px" >
                    </div>
                    <div class="input-prepend">
                        <span class="add-on" style="color: #333">状态</span>
                        <input id="approvalStatus" type="text" style="width:100px;height:30px"  />
                    </div>
                    <button type="button" class="btn btn-info" id="search">查询</button>
                </div>
            </div>
            <!--操作面板 结束 -->
            <!--数据表格-->
            <div style="width:99%;margin:0 auto;height:88%">
                <table id="limitGrid" style="width:100%;height:100%"></table>
            </div>
            
            <!--+++++++++++++++++++数据添加、编辑弹出框+++开始++++++++++++++++-->
	<div id="tjym" class="easyui-dialog" style=" padding: 10px 20px;width: 750px;height: 300px;" closed="true" buttons="#tjym-buttons" data-options="iconCls:'icon-save',resizable:true,modal:true"> 
       <form id="fm_tjym" method="post">
			<table class="new_table" style="margin:0 auto;">
				<tr >
					<td colspan="2">
						<div class="fitem" >
							<input type="file" id="imgName" />
                            <img id="imgName" width="100" height="100" />
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="2">
                        <div class="fitem">
							状态：&nbsp;&nbsp;
                            使用：<input type="radio" checked="checked" name="flag" value="0" />&nbsp;
                            禁用：<input type="radio" name="flag" value="1" />
						</div>
                    </td>
				</tr>
				<tr>
					<td colspan="2"><div class="fitem">
							<label>备注：</label>
							<textarea name="limitReason" rows="3" cols="30"
								style="width: 544px;margin-top:14px;" class="textarea easyui-validatebox"
								id="xdyy_add"></textarea>
						</div></td>
				</tr>
			</table>
			<input type="hidden" name="action" id="tjym_action" />
	       <input type="hidden" name="id" id="tjym_id" />
       </form>
   </div>
	<div id="tjym-buttons">
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="saveuser()" iconcls="icon-save" id="baocun">保存</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="javascript:$('#tjym').dialog('close')" iconcls="icon-cancel" id="quxiao">取消</a> 
    </div>
<!--+++++++++++++++++++数据添加、编辑弹出框+++结束++++++++++++++++-->
        </div>
    </body>
    <script type="text/javascript">
        $(function(){
            init();
            initTable();
        }) 
        
        function init(){
            $("#approvalStatus").combobox({
			 //url:'<%=path%>normalplan/getParamByParamCode.action?paramCode=approvalStatus',
			 valueField: 'value',
		     textField: 'label',
		     value:"-1",
             data: [{
                        label: '全部',
                        value: '-1'
                    },{
                        label: '使用',
                        value: '1'
                    },{
                        label: '禁用',
                        value: '2'
                    }],
			 editable:false
		});
            
            
        }
        
    function initTable(){
		$("#limitGrid").datagrid({
			//url:'limitPlan/query.action',
			method:'post',
			width:'100%',
			rownumbers:true,
			singleSelect:true,
			fitColumns:true,
			pagination:true,
			onLoadSuccess:function(data){
			},
			columns:[[{field:'id',title:'唯一表示',width:0,align:'center'},
                      {field:'imgName',title:'图片名称',width:130,align:'center'},
				      {field:'imgUrl',title:'路径',width:120,align:'center'},
				      {field:'operator',title:'操作人员',width:120,align:'center'},
				      {field:'operatTime',title:'操作时间',width:70,align:'center'},
				      {field:'param1',title:'预留字段',width:60,align:'center'},
				      {field:'opt',title:'状态',width:80,align:'center',formatter:formatOper}
				    ]],
			toolbar:[
                  {text:"增加",iconCls:"icon-add",handler:function(){	
                	  $("#tjym").dialog("open").dialog('setTitle', '产品新增');				//打开添加面板
                      $("#fm_tjym").form("clear");								//清除表单数据
          			 
                  }},
                  {text:"删除",iconCls:"icon-remove",handler:function(){
                    var row = $('#limitGrid').datagrid('getSelected');
                    if(row==null) return $.messager.alert("提示信息", "当前没有选中记录！");
       	            if(row!=null&&row.opt!=0){
       	                $.messager.confirm('提示信息','确定删除吗?', function (r) {
       					if (r) {
       	                        $.messager.alert("提示信息", "删除成功");
       	                    }
       	                });
       	            }else{
       	            	$.messager.alert("提示信息", "记录当前状态不能被删除！");
       	            }
                  }},
                  {text:"修改",iconCls:"icon-edit",handler:function(){  
                      var row = $('#limitGrid').datagrid('getSelected');
                      if(row==null) return $.messager.alert("提示信息", "当前没有选中记录！");
                	  $.messager.alert("提示信息", "暂时没做，和添加页面基本一样！");
                  }}
			], 
            data: [
                {id:'1',imgName:'公司信息1', imgUrl:'E:/imgFiles/a.png',operator:'拓跋野',operatTime:'2016-11-5 21:40:38',param1:'~',opt:'0'},
                {id:'2',imgName:'公司信息2', imgUrl:'E:/imgFiles/b.png',operator:'拓跋野',operatTime:'2016-11-5 21:40:38',param1:'~',opt:'0'},
                {id:'3',imgName:'公司信息3', imgUrl:'E:/imgFiles/c.png',operator:'拓跋野',operatTime:'2016-11-5 21:40:38',param1:'~',opt:'0'},
                {id:'4',imgName:'公司信息4', imgUrl:'E:/imgFiles/d.png',operator:'拓跋野',operatTime:'2016-11-5 21:40:38',param1:'~',opt:'1'}
            ],

          queryParams:{
        	  beginTime:"",
        	  endTime:"",
        	  orgNo:"",
        	  approvalStatus:"",
        	  id:""
          }
		});
	   
	   var p = $('#limitGrid').datagrid('getPager'); 
          $(p).pagination({ 
              pageSize: 10,//每页显示的记录条数，默认为10
              pageList:[5,10,15,20],//每页显示几条记录
              beforePageText: '第',//页数文本框前显示的汉字
              afterPageText: '页    共 {pages} 页',
              displayMsg: '当前显示 {from} - {to} 条记录    共 {total} 条记录',
              onBeforeRefresh:function(){ 
                  $(this).pagination('loading');//正在加载数据中...
                  $(this).pagination('loaded'); //数据加载完毕
              } 
          }); 
	}
        
        //保存方法
	function saveuser(){
		
        $.messager.alert("提示信息","操作成功");
		$("#tjym").dialog("close");		    //关闭操作窗口
    }
        
    function formatOper(val,row){
        var str = '<center>';
        
        if('0'==val){
            str += '使用：<input type=\"radio\" checked=\"checked\" name=\"flag'+row.id+'\" value=\"0\" />&nbsp;';
            str += '禁用：<input type=\"radio\" name=\"flag'+row.id+'\" value=\"1\" />';
            
        }else{
            str += '使用：<input type=\"radio\" name=\"flag'+row.id+'\" value=\"0\" />&nbsp;';
            str += '禁用：<input type=\"radio\" checked=\"checked\" name=\"flag'+row.id+'\" value=\"1\" />';
            
        }
        
		return str+'</center>';
    }
    </script>
</html>
